<?php include_once("../../../common/common_setting_unit.php");         // 引入通用的设置文件 ?>
<?php include_once(ROOT_PATH_ . "/controller/common/module/head.php"); // 引入通用的头部 ?>
<?php include_once("../controller/detail-edit.php");                     // 当前页面的控制器 ?>






    <?
    //==============================================================================
    //这里开始才是平常开发需要注重的部分，其余的基本不用理会
    //==============================================================================
    ?>

        <div id="window" style="padding: 15px">

            <!--标题设定-->
            <?php $page_title='订单信息';?>
            <?php include ROOT_PATH_ . '/controller/common/module/mod-page-title.php'; ?>


            <blockquote class="layui-elem-quote"> 这是客户申请退款的信息，要取消退款，请同样提交申请，在备注中注明情况即可。
                <br/>后续审核的时候选择撤销，即可把订单状态从"待退款"转换成"已付款"</blockquote>


            <div class="info">

                <div class="sbox">
                    <div class="relation">
                        <text class="state"><? echo $order_info['order_sn']?></text>
                        <text>客户订单号</text>
                    </div>
                </div>


                <div class="sbox">
                    <div class="relation">
                        <text class="state"><? echo $order_info['transaction_id']?></text>
                        <text>TRANSACTION_ID</text>
                    </div>
                </div>

                <div class="sbox">
                    <div class="relation">
                        <text class="state"><? echo $order_info['order_id']?></text>
                        <text>订单编号</text>
                    </div>
                </div>

<br class="clearfloat"/>

                <div class="sbox">
                    <div class="relation">
                        <text class="state"><? echo $order_info['order_name']?></text>
                        <text>套餐名称</text>
                    </div>
                </div>


                <div class="sbox">
                    <div class="relation">
                        <text class="state"><? echo $order_info['order_price']?></text>
                        <text>订单总额</text>
                    </div>
                </div>




            </div>



            <div class="info">

                <div class="sbox">
                    <div class="relation">
                        <text class="state"><? echo $order_info['student_name']?></text>
                        <text>学生</text>
                    </div>
                </div>


                <div class="sbox">
                    <div class="relation">
                        <text class="state"><? echo $order_info['student_info']?> </text>
                        <text>班别</text>
                    </div>
                </div>

                <div class="sbox">
                    <div class="relation">
                        <text class="state">
<? $_student=select_one_line_all_items($table_prefix.'member_child',"nid='{$order_info['student_nid']}'") ?>
                            <? echo $_student['phone'] ?></text>
                        <text>订单电话</text>
                    </div>
                </div>


                <div class="sbox">
                    <div class="relation">
                        <text class="state"><? echo $user['phone'] ?></text>
                        <text>家长电话</text>
                    </div>
                </div>

                <br class="clearfloat"/>

                <div class="sbox">
                    <div class="relation">
                        <text class="state"><? echo $pay_status[$order_info['pay_status']]?></text>
                        <text>支付状态</text>
                    </div>
                </div>


            </div>


            <br/>  <br/>
            <!--标题设定-->
            <?php $page_title='退款申请记录';?>
            <?php include ROOT_PATH_ . '/controller/common/module/mod-page-title.php'; ?>




            <?if(count(array_filter($refund_apply_list))){?>

            <table  class="layui-table">
                <thead>
                <tr>
                    <th>退款金额</th>
<!--                    <th>用户申请时间</th>-->
<!--                    <th>退款时间</th>-->
                    <th>内部申请时间</th>
                    <th>申请人</th>
                    <th>退款理由</th>
                    <th>停止配送时间</th>
                    <th>审核状态</th>
                    <th>审核时间</th>
                </tr>
                </thead>
                <tbody>

                <?php
                foreach ($refund_apply_list as $key2=> $value2) {
                    ?>
                    <tr>
                        <td><?echo $value2['price']?></td>
<!--                        <td> </td>-->
<!--                        <td> </td>-->
                        <td><?echo $value2['apply_date']?></td>
                        <td><?echo $value2['apply_employee']?></td>
                        <td><?echo $value2['remark']?></td>
                        <td><?echo $value2['stop_deliver_date']?></td>
                        <td><?echo $value2['apply_status']?></td>
                        <td><?echo $value2['aprove_date']?></td>
                    </tr>
                <?}?>

                </tbody>
            </table>
                <?;}else{?>
                <div style="text-align: center">暂无记录</div>

            <?}?>



            <!--标题设定-->
            <?php $page_title='退款成功记录';?>
            <?php include ROOT_PATH_ . '/controller/common/module/mod-page-title.php'; ?>


            <?if(count(array_filter($refund_info))){?>

                <table  class="layui-table">
                    <thead>
                    <tr>
                        <th>退款金额</th>
                        <th>退款时间</th>
                        <th>退款产品</th>
                    </tr>
                    </thead>
                    <tbody>

                    <?php
                    foreach ($refund_info as $key => $value) {
                        ?>
                        <tr>
                            <td><?echo $value['price']/100?></td>
                            <td><?echo $value['add_date']?></td>
                            <td><?echo $product_name_list[$value['event_id']]?></td>
                        </tr>
                    <?}?>

                    </tbody>
                </table>
                <?;}else{?>
                <div style="text-align: center">暂无退款记录</div>

            <?}?>



            <br/>  <br/>

            <ul class="detail-box">
                <form id="data_form" method="post" class="layui-form"
                      action ="data_refund_apply_process.php?<? echo $url_parameter ?>"
                      enctype="multipart/form-data">

                    <input type="hidden"  name="ai_order_nid" value="<? echo $order_info['order_id']?>" >


        <!--标题设定-->
                    <?php $page_title='订单退款申请表';?>
                    <?php include ROOT_PATH_ . '/controller/common/module/mod-page-title.php'; ?>


                    <blockquote class="layui-elem-quote">此表格为退款申请表，请根据实际情况调整内容</blockquote>

                    <!--普通的textarea多行文本输入-->
                    <li class="layui-form-item introduce">
                        <label class="layui-form-label">退款原因：</label>
                        <div class="layui-input-block">
                            <textarea class="layui-textarea" disabled  name="ai_refund_reason"><?echo  $order_info['refund_reason']?>   </textarea>
                            <em class="notice" style="color: red">家长填写的退款原因，内部记录，请填写备注<br/></em>
                        </div>
                    </li>


                    <!--普通的textarea多行文本输入-->
                    <li class="layui-form-item introduce">
                        <label class="layui-form-label">申请日期：</label>
                        <div class="layui-input-block">
                            <input type="text" class="layui-input laydate_time" disabled value="<?echo $order_info['refund_apply_date']?>"/>
                            <em class="notice" >家长申请退款的时间</em>
                        </div>
                    </li>

<!--                    <li class="layui-form-item introduce">-->
<!--                        <label class="layui-form-label">退款日期：</label>-->
<!--                        <div class="layui-input-block">-->
<!--                            <input type="text"  disabled class="layui-input laydate_time" value="--><?//echo $order_info['refund_date']?><!--"/>-->
<!--                            <em class="notice" >系统记录实际日期</em>-->
<!--                        </div>-->
<!--                    </li>-->


                    <!--普通的textarea多行文本输入-->
                    <li class="layui-form-item introduce">
                        <label class="layui-form-label">退款金额：</label>
                        <div class="layui-input-block">
                            <input type="text" class="layui-input"  required
                                   name="ai_price"
                                   <?if($_REQUEST['date']){?>
                                       value=""
                                   <?}else{?>
                                   value="<?echo $order_info['order_price']?>"
                                   <?}?>
                            />
                            <em class="notice">下方按钮，用于线上退款，退款金额不能大于订单金额，会原路返回款项。退款成功会自动修改订单状态为已退款</em>
                        </div>

                    </li>



                    <li class="layui-form-item introduce">
                        <label class="layui-form-label">停止配送：</label>
                        <div class="layui-input-block">
<?foreach ($order_detail as $key => $value){?>
                            <input type="checkbox" name="ai_stop_deliver_date[]"
                                   title="<?echo substr($value['ondate'],0,10)?> - <?echo $value['status']?>"
                                   <?if(($_REQUEST['date'])&&($_REQUEST['date'] == $value['ondate'])){echo "checked";}
                                     elseif((!$_REQUEST['date']) && ($value['status']=='正常')){echo "checked";}
                                     ?>
                                   class="layui-input laydate_time" value="<?echo $value['ondate']?>"/>
<?}?>
                            <br class="clearfloat"/>
                            <em class="notice" style="color: red">停止配送日期，将会在退款申请审核之后，生效。请注意审核<br/></em>
                        </div>
                    </li>





                    <!--普通的textarea多行文本输入-->
                    <li class="layui-form-item introduce">
                        <label class="layui-form-label">备注：</label>
                        <div class="layui-input-block">
                            <textarea class="layui-textarea" name="ai_remark"  ><?echo  $order_info['remark']?></textarea>
                            <em class="notice">(填写本文的概述)</em>
                        </div>
                    </li>



                    <div class="function" >

                        <button class="layui-btn"  lay-submit type="submit" >立即提交</button>

                        <input type="reset" class="layui-btn" value="重置"/>

                    </div>



                </form>
            </ul>

        </blockquote>



        <?
        //==============================================================================
        //这里上面才是平常开发需要注重的部分，下面的基本不用理会，只有底部JS部分需要根据实际情况去加载
        //==============================================================================
        ?>



            </div>
            <!--detail-box end-->


        </div>
        <!--content端點01-->



</div>
<!--maincontent-->
<br class="clearfloat"/>
</div>
<!--container-->
</div>





<!--渲染日期需要用到的-->
<script>
    layui.use('laydate', function(){
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#publish_date' //指定元素
            ,type: 'datetime'
        });
    });
</script>





<?php include ROOT_PATH_ . "/controller/common/module/footer.php"; ?>
